<template>
    <el-card>
        <div slot="header" class="clearfix">
            <span style="line-height: 36px;">{{type}}医生</span>
            <el-button type="primary" style="float:right" @click="submint">
                提交
            </el-button>
        </div>
        <el-form :inline="true" :model="form" class="demo-form-inline">
            <el-row :gutter="20">
                <el-col :span="12">
                    <el-form-item label="姓名" label-width="100px">
                        <el-input v-model="form.DOCTOR_NAME"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="性别" label-width="100px">
                        <el-select v-model="form.DOCTOR_SEX" placeholder="性别">
                            <el-option label="男" value="男"></el-option>
                            <el-option label="女" value="女"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="20">
                <el-col :span="12">
                    <el-form-item label="电话" label-width="100px">
                        <el-input v-model="form.DOCTOR_TEL"></el-input>
                    </el-form-item>
                </el-col>

                <el-col :span="12">
                    <el-form-item label="所属地区" label-width="100px">
                          <el-input v-model="form.DOCTOR_ADDRESS"></el-input>                      
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="20">
                <el-col :span="12">
                    <el-form-item label="详细地址" label-width="100px">
                        <el-input v-model="form.DOCTOR_ADDRESSDETAIL"></el-input>
                    </el-form-item>
                </el-col>

                <el-col :span='12'>

                    <el-form-item label="擅长专业" label-width="100px">
                        <el-input v-model="form.DOCTOR_MAJOR"></el-input>                       
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="20">
                <el-col :span="12">
                    <el-form-item label="病人评价" label-width="100px">
                        <el-select v-model="form.DOCTOR_EVALUATE" placeholder="病人评价">
                            <el-option label="一星" value="一星"></el-option>
                            <el-option label="二星" value="二星"></el-option>
                               <el-option label="三星" value="三星"></el-option>
                            <el-option label="四星" value="四星"></el-option>
                               <el-option label="五星" value="五星"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>

                <el-col :span="12">
                    <el-form-item label="毕业院校" label-width="100px">
                        <el-input v-model="form.DOCTOR_SCHOOL"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="20">
                <el-col :span="12">
                    <el-form-item label="教育经历" label-width="100px">
                        <el-select v-model="form.DOCTOR_EDUCATION" placeholder="教育经历">
                            <el-option label="本科" value="本科"></el-option>
                            <el-option label="研究生" value="研究生"></el-option>
                            <el-option label="博士" value="博士"></el-option>
                            <el-option label="其他" value="其他"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="合作医疗机构" label-width="100px">
                        <el-input v-model="form.DOCTOR_ORGANAZATION"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="工作经历" label-width="100px">
                        <el-input type="textarea" v-model="form.DOCTOR_EXPERIENCE"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>

        </el-form>
    </el-card>
</template>

<script>
import api from "@/js/api";
import getid from "@/js/getid";
export default {
  data() {
    return {
      name: "",
      form: {
        DOCTOR_ID: "",
        DOCTOR_NAME: "",
        DOCTOR_SEX: "",
        DOCTOR_TEL: "",
        DOCTOR_ADDRESS: "",
        DOCTOR_ADDRESSDETAIL: "",
        DOCTOR_EVALUATE: "",
        DOCTOR_SCHOOL: "",
        DOCTOR_EDUCATION: "",
        DOCTOR_ORGANAZATION: "",
        DOCTOR_EXPERIENCE: "",
        DOCTOR_MAJOR: ""
      }
    };
  },
  props: {
    type: {
      type: String,
      default: ""
    },
    Id: {
      type: String,
      default: ""
    }
  },
  methods: {
    submint() {
      if (this.type == "新增") {
        this.form.DOCTOR_ID = getid.getid();
        api.DOCTORAdd(this, this.form);
      } else {
        api.DOCTORUpdate(this, this.form);
      }
    }
  },
  created() {
    if (this.type == "查看") {
      let that = this;
      api.DOCTORGetOne(that, { Id: that.Id }, function(msg) {
        that.form = msg.Result;
      });
    }
  }
};
</script>

<style>

</style>
